package com.yang.SpringTest.java;

/**
 * <p>KillJavaTest</p>
 *
 * @author By: chengxuyuanshitang
 * Package com.yang.SpringTest.java
 * Ceate Time 2024-04-13 09:49
 */
public class ShutdownHookTest {
    public static void main (String[] args) {

        boolean flag = true;
        Runtime.getRuntime ().addShutdownHook (new Thread (new Runnable () {
            public void run () {
                System.out.println ("Run shutdown hook now.");
            }
        }, "ShutdownHookTest"));
        while (flag) {
        }
        System.out.println ("程序退出");
    }
}

